package com.sky.controller.user;

import com.sky.constant.ShopStatusConstant;
import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户店铺操作接口")
@Slf4j
@RestController
@RequestMapping("/user/shop")
public class UserShopController {
	//注入redis获取商店状态
	@Autowired
	RedisTemplate<String, Object> redisTemplate;

	/**
	 * 获取商店状态
	 * @return
	 */
	@ApiOperation("获取营业状态")
	@GetMapping("/status")
	public Result getStatus(){
		Integer shopStatus = (Integer) redisTemplate
										.opsForValue()
										.get(ShopStatusConstant.SHOP_STATUS);
		log.info("获取商店状态{}",shopStatus);
		return Result.success(shopStatus);
	}

}
